<template>
  <div v-if="visible" class="modal-overlay">
    <div class="modal-container">
      <button class="close-button" @click="$emit('close')">关闭</button>
      <h3>详细信息</h3>
      <table class="custom-table">
        <thead>
          <tr>
            <th>工号</th>
            <th>姓名</th>
            <th>技能等级</th>
            <th>所在岗位</th>
            <th>所在工位</th>
            <th>所在站位</th>
            <th>所在产线</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>{{ worker.number }}</td>
            <td>{{ worker.name }}</td>
            <td>{{ worker.grade }}</td>
            <td>{{ worker.position1 }}</td>
            <td>{{ worker.position2 }}</td>
            <td>{{ worker.position3 }}</td>
            <td>{{ worker.line }}</td>
          </tr>
        </tbody>
      </table>

      <h3>工作计划甘特图</h3>
      <GanttChart :tasks="tasks" class="gantt-chart-container" />
    </div>
  </div>
</template>

<script>
import GanttChart from './GanttChart.vue';

export default {
  name: 'ModalModal',
  components: {
    GanttChart
  },
  props: {
    visible: {
      type: Boolean,
      required: true
    },
    worker: {
      type: Object,
      required: true
    },
    tasks: {
      type: Array,
      required: true
    }
  }
};
</script>

<style scoped>
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-container {
  background: white;
  padding: 20px;
  border-radius: 5px;
  width: 80%;
  max-width: 600px;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
}
</style>
